<%-- 
    Document   : FileDetails
    Created on : Apr 8, 2011, 12:16:41 PM
    Author     : Tiong Jia Ming
    Admin No   : 0900960
    Class      : DISM/FT/2A/02
--%>


<%@page import="File.Scribd"%>
<%@page import="java.io.File"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="DB.DBConnectionJm"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="File.FileProperties"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
                    String ID = request.getParameter("ID");
                    Scribd scribd = new Scribd();
                    FileProperties myBean = (FileProperties) request.getSession().getAttribute(request.getParameter("ID"));
                    out.println("<table>");
                    out.println("<tr><td rowspan=5>");
                    out.println("<img src=\"" + scribd.getThumbnail(myBean.getScribdID()) + "\"/>");
                    out.println("</td>");
                    out.println("<td>");
                    out.println("<table border=1>");
                    out.println("<tr><th>Name:</th><td>" + myBean.getFileName() + "</td></tr>");
                    out.println("<tr><th>Description:</th><td>" + myBean.getFileDesc() + "</td></tr>");
                    out.println("<tr><th>Size of File:</th><td>" + myBean.getFileSize() + "</td></tr>");
                    out.println("<tr><th>Numbers of Downloads:</th><td>" + myBean.getFileDownloads() + "</td></tr>");
                    out.println("<tr><th>Uploaded Since:</th><td>" + myBean.getFileUploadDate() + "</td></tr>");
                    out.println("</table>");
                    out.println("</td>");
                    out.println("</tr>");
                    out.println("</table>");
                    out.println("<a href=\"ScribdView.jsp?id=" + myBean.getScribdID() + "&key=" + myBean.getFileKey() + "\">View the Doc Online!</a>");
                    DBConnectionJm dbc = new DBConnectionJm();
                    dbc.setQuery("select * from FileRecords where fileScribdID=?");
                    dbc.setAttributes(new String[]{myBean.getScribdID()});
                    ResultSet rs = dbc.doQuery();
                    ServletContext context = this.getServletContext();
                    while (rs.next()) {
                        out.println("<a href=\"../FileDownload?fileName=" + myBean.getFileName() + "&fileID=" + myBean.getScribdID().toString() + "\">Download " + myBean.getFileName() + "</a>");
                    }

        %>

    </body>
</html>
